<?php
/**
 * 商品规格名表 - 规格影响价格
 *
 * @author Zeon <scplay@gmail.com>
 * @date 2018/6/7
 * @copyright PanxSoft Inc.
 */
namespace App\Models\Panx;

use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;

/**
 * @property int id
 * @property-read Collection specValues
 * @property-write Collection values - spec values collection
 */
class Spec extends Model
{
    protected $table = 'specs';

    protected $guarded = [];

    /**
     * @used-by specValues
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function specValues()
    {
        return $this->hasMany(SpecValue::class, 'spec_id', 'id');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function productMod()
    {
        return $this->belongsTo(ProductMod::class, 'product_mod_id', 'id');
    }
}
